//package com.lijz.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import com.baomidou.mybatisplus.core.config.GlobalConfig;
//import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
//import org.apache.ibatis.session.SqlSessionFactory;
//import org.mybatis.spring.annotation.MapperScan;
//import org.springframework.beans.factory.annotation.Qualifier;
//import org.springframework.boot.context.properties.ConfigurationProperties;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//
//import javax.sql.DataSource;
//
///**
// * @author lijingzhao
// * @date 2018/11/8 19:10
// */
//@Configuration
//@MapperScan(basePackages = "com.lijz.two.**.mapper",sqlSessionFactoryRef  = "twoSqlSessionFactory")
//public class TwoDataSource {
//	@Bean(name = "dataSourceTwo")
//	@ConfigurationProperties(prefix = "spring.datasource.two")
//	public DataSource twoDataSource() {
//		return new DruidDataSource();
//	}
//	@Bean(name = "twoTransactionManager")
//	public DataSourceTransactionManager twoTransactionManager() {
//		return new DataSourceTransactionManager(twoDataSource());
//	}
//
//	@Bean(name = "twoSqlSessionFactory")
//	public SqlSessionFactory twoSqlSessionFactory(@Qualifier("dataSourceTwo") DataSource basicDataSource) throws Exception {
//		MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean();
//		factoryBean.setDataSource(basicDataSource);
//		factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/**/*Mapper.xml"));
//		factoryBean.setTypeAliasesPackage("com.lijz.two.**.entity");
//		factoryBean.setGlobalConfig(globalConfigTwo());
//		return factoryBean.getObject();
//	}
//
//	@Bean
//	@ConfigurationProperties(prefix = "mybatis-plus.global-config:")
//	public GlobalConfig globalConfigTwo() {
//		return new GlobalConfig();
//	}
//
//}
